<template>
	<view class="user-like">
		<block v-if="show">
			<view class="user-like-list" v-if="list.length">
				<view class="user-like-item" v-for="(data,index) in list" :key="index">
					<u-image width="76rpx" height="76rpx" :src="data.heard_img" mode="" border-radius="50%"></u-image>
					<view class="user-like-info">
						<view class="user-like-item-name">{{data.nickname}}</view>
						<view class="user-like-item-time">{{data.add_time}}</view>
					</view>
				</view>
			</view>
			<pt-loading-more v-if="isLoading"></pt-loading-more>
			<pt-nomore v-if="list.length && noMore"></pt-nomore>
			<pt-nothing 
				v-if="!list.length && noMore"
				:fixed="true" 
				text="还没有人点赞哦,赶紧分享给朋友点赞吧" 
				icon="https://jiajudashi.oss-cn-shenzhen.aliyuncs.com/images/shop/icons/nothing.png?v=1">
			</pt-nothing>
		</block>
		<pt-loading></pt-loading>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				match_id: '',
				list: [],
				isLoading: false,
				noMore: false,
				page: 0
			};
		},
		onLoad(options) {
			this.match_id = options.match_id
			this.getLikeUser()
		},
		methods: {
			getLikeUser(match_id){
				this.$u.api.likeList({match_id: this.match_id,page: this.page}).then(res => {
					this.show = true
					this.isLoading = false
					if(res.datas.length){
						res.datas.forEach(item => {
							this.list.push(item)
						})
					}else{
						this.noMore = true
					}
				})
			}
		},
		onReachBottom() {
			if(!this.noMore){
				this.page++
				this.isLoading = true
				this.getLikeUser()
			}
		}
	}
</script>

<style lang="scss">
	.user-like-list{
		padding: 0 30rpx;
		.user-like-item{
			padding: 30rpx 0;
			border-bottom: solid 2rpx #F7F7F7;
			display: flex;
			align-items: center;
			.user-like-info{
				flex: 1;
				min-width: 0;
				margin-left: 30rpx;
				.user-like-item-name{
					font-size: 28rpx;
					margin-bottom: 10rpx;
				}
				.user-like-item-time{
					font-size: 22rpx;
					color: #999;
				}
			}
		}
	}
</style>
